PlantWise Help

Table Function Format

There are several table functions; however, the format of the function call is the same:
  • For a table with a single key:
    <table-function>(“<table name>” <value from key> “<column name>”)
  • For a table with n keys:
    <table-function>(“<table name>” <value from key 1> 
    <value from key 2> ... <value from key n> “<column name>”)
The <table name> defines the table to search and must be a quoted text string.
The key values can be constants; if so, you must quote the value. On the other hand, if an attribute is being used (such as pipeline.diameter) for the <value from key> variable, do not place it in quotation marks.
table-lookup(“dpar-reducer-properties” pipeline.diameter “length”)
The “<column name>” is the name of the column in the table where the desired information is. The column name must be contained in quotation marks.

Example 1: Simple Single Key

A partial listing of the table sample-cost-factors:
Table: DPAR-SAMPLE-COST-FACTORS
MATERIAL* COST-FACTORS
“1 1/4 Cr 1/2 Molly” 3.43
“304 SS/Alloy 20” 6.0
“304L SS” 3.44
“316 Stainless Steel” 4.38
“5 Cr 1/2 Moly” 4.07
“9 Cr 1 Moly” 5.5
.. ..
The function call:
table-lookup(“dpar-sample-cost-factors” “304L SS” “costfactor”)
will yield an output of 3.44.

Example 2: Simple Multiple Keys

Partial listing of pipe-rating-properties.
Table: DPAR-PIPE-RATING-PROPERTIES
PIPE-CLASS* DIAMETER* FLANGE-OD LR-ELL&WNKFLG...
150 100.0 228.6 228.6...
150 125.0 254.0 279.4...
150 15.0 88.9 85.725..
... ... ... ......
300 100.0 254.0 238.125...
300 125.0 279.4 288.925..
300 15.0 95.25 90.4875...
... ... ... ......
The function call:
table-round(“dpar-pipe-rating-properties” 	150 	20.0  “flange-od”)
will yield an output of 88.9.

Example 3: Using an Attribute

The function call:
table-lookup(“dpar-sample-cost-factors” pipeline.material 
“cost-factor”)
will look up the cost-factor associated with the type of material.

Example 4: Using Multiple Tables

The function call:
table-lookup(“dpar-sample-cost-factors” 
(table-lookup(“dpar-pipe-class-properties” pipeline-segment.class “material”) “cost-factor”)
will look up the cost-factor associated with the type of material found in the pipe-classproperties table.